<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@page import="portal.vo.*" %>
<%@page import="java.util.*" %>
<script type="text/javascript" src="scripts/ajax.js"></script>
<script>

function detalleProducto(selurl) {

    var left       = 50;
    var top        = 50;
    var height     = 500;
    var width      = 400;
    var scrollbars = 'yes';
  
    selector = window.open (selurl, "Selector", "toolbar=no,directories=no,scrollbars=" + scrollbars + ",menubar=yes,status=yes,resizable=no,width=" + width + ",height=" + height + ",left=" + left + ",top=" + top);  
    }



</script>

<%
List<ProductoVO> productos = new ArrayList<ProductoVO>();
if(session.getAttribute("listaProductos") != null)
	productos = (List<ProductoVO>)session.getAttribute("listaProductos");
%>

<form action="/PortalWeb/OrdenarColumnaServlet" method="post">
<a name="inicio"></a>
<div style="width: 100%; height: 100%; overflow:scroll">
<table class="listaResultadoContenedor" cellSpacing=1 cellPadding=3 align="center" border=0>
	<tbody>
		<tr>
			<td class=titulotabla align="center" width="16%">Imagen</td>
			<td class=titulotabla align="center" width="16%">Nombre</td>
			
			<td class="titulotabla" align="center" width="16%"> 
			 <table>
			  <tr>
			   <td class=titulotabla nowrap="nowrap">Categoria</td>
			   <td align="center">
				<A HREF="#inicio" id="arribaCAT"  onclick="requestContent('/PortalWeb/OrdenarColumnaServlet?columna=COL_CAT&tipoOrden=1')" style="text-decoration:none; color:blue;"><span style="font-size: 9pt; font-family: Symbol; font-weight: bolder;">&#8743;</span></A><br>
				<A HREF="#inicio" id="abajoCAT" onclick="requestContent('/PortalWeb/OrdenarColumnaServlet?columna=COL_CAT&tipoOrden=-1')" style="text-decoration:none; color:blue;"><span style="font-size: 9pt; font-family: Symbol; font-weight: bolder;">&#8744;</span></A>
			   </td>
			  </tr>
			 </table>
			</td>
			
			<td class=titulotabla align="center" width="16%">Marca</td>
			
			<td class="titulotabla" align="center" width="16%"> 
			 <table>
			  <tr>
			   <td class=titulotabla nowrap="nowrap">Fecha</td>
			   <td align="center">
				<A HREF="#inicio" id="arribaFECHA"  onclick="requestContent('/PortalWeb/OrdenarColumnaServlet?columna=COL_FECHA&tipoOrden=1')" style="text-decoration:none; color:blue;"><span style="font-size: 9pt; font-family: Symbol; font-weight: bolder;">&#8743;</span></A><br>
				<A HREF="#inicio" id="abajoFECHA" onclick="requestContent('/PortalWeb/OrdenarColumnaServlet?columna=COL_FECHA&tipoOrden=-1')" style="text-decoration:none; color:blue;"><span style="font-size: 9pt; font-family: Symbol; font-weight: bolder;">&#8744;</span></A>
			   </td>
			  </tr>
			 </table>
			</td>
			
			<td class="titulotabla" align="center" width="16%"> 
			 <table>
			  <tr>
			   <td class=titulotabla nowrap="nowrap">Precio</td>
			   <td align="center">
				<A HREF="#inicio" id="arribaPRECIO"  onclick="requestContent('/PortalWeb/OrdenarColumnaServlet?columna=COL_PRECIO&tipoOrden=1')" style="text-decoration:none; color:blue;"><span style="font-size: 9pt; font-family: Symbol; font-weight: bolder;">&#8743;</span></A><br>
				<A HREF="#inicio" id="abajoPRECIO" onclick="requestContent('/PortalWeb/OrdenarColumnaServlet?columna=COL_PRECIO&tipoOrden=-1')" style="text-decoration:none; color:blue;"><span style="font-size: 9pt; font-family: Symbol; font-weight: bolder;">&#8744;</span></A>
			   </td>
			  </tr>
			 </table>
			</td>
			
			<td class="titulotabla" align="center" width="16%"> 
			 <table>
			  <tr>
			   <td class=titulotabla nowrap="nowrap">Ranking</td>
			   <td align="center">
				<A HREF="#inicio" id="arribaRANK"  onclick="requestContent('/PortalWeb/OrdenarColumnaServlet?columna=COL_RANK&tipoOrden=1')" style="text-decoration:none; color:blue;"><span style="font-size: 9pt; font-family: Symbol; font-weight: bolder;">&#8743;</span></A><br>
				<A HREF="#inicio" id="abajoRANK" onclick="requestContent('/PortalWeb/OrdenarColumnaServlet?columna=COL_RANK&tipoOrden=-1')" style="text-decoration:none; color:blue;"><span style="font-size: 9pt; font-family: Symbol; font-weight: bolder;">&#8744;</span></A>
			   </td>
			  </tr>
			 </table>
			</td>
			
			<td class=titulotabla align="center" width="16%">&nbsp;</td>
			<td class=titulotabla align="center" width="16%">&nbsp;</td>
		</tr>
		<%int i = 0; %>
		<%for(ProductoVO p: productos) { %>
		<% i++; %>
		 <%
              if ((i % 2) == 0) {
                out.println("<TR align=\"center\" class=\"odd\">");
              } else {
                out.println("<TR align=\"center\" class=\"even\">");
              }
            %>
			<td class=azul align="center"><IMG alt="foto" src=<%=p.getImagen() %> style="max-height: 300px; max-width: 300px;" border="0" /></td>
			<td class=azul align="center"><%= p.getNombre() %></td>
			<td class=azul align="center"><%= p.getCategoria() %></td>
			<td class=azul align="center"><%= p.getMarca() %></td>
			<td class=azul align="center"><%= p.getFechaString() %></td>
			<td class=azul align="right">$ <%= p.getPrecio() %></td>
			<td class=azul align="right"><%= p.getRanking()%></td>
			<td class=azul align="center"><a href="#" onclick="javascript:detalleProducto('/PortalWeb/ObtenerDetalleServlet?id=<%= p.getId() %>')">Ver detalle</a></td>
			<td class=azul align="center"><a href="#" onclick="requestContentCarrito('/PortalWeb/AgregarACarritoServlet?id=<%= p.getId() %>')">Agregar a carrito</a></td>
		<%
              out.println("</TR>");
            %>
		<%} %>
	 	<tr bgColor=#cccccc>
	  	    <TD>&nbsp;</TD>
	        <TD>&nbsp;</TD>	      
	  	    <TD>&nbsp;</TD>
	  	    <TD>&nbsp;</TD>
	  	    <TD>&nbsp;</TD>
	  	    <TD>&nbsp;</TD>
	  	    <TD>&nbsp;</TD>
	  	    <TD>&nbsp;</TD>
	  	    <TD>&nbsp;</TD>
        </tr>

	</tbody>
</table>
</div>


</form>